package 迭代器;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class Client {
    public static void main(String[] args) {
        List<College> colleges = new ArrayList<>();
        colleges.add(new ComputerCollege());
        colleges.add(new InfoCollege());

        Iterator<College> iterator = colleges.iterator();
        while (iterator.hasNext()) {
            College next = (College)iterator.next();
            System.out.println(next.CollegeName());
            Iterator collegeIterator = next.getCollegeIterator();

            while (collegeIterator.hasNext()) {
                DepartMent o =(DepartMent) collegeIterator.next();
                System.out.println(o);

            }

        }
    }
}
